import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:url_launcher/url_launcher.dart';

import '../../config/const_config.dart';
import '../card/card.dart';

// 我的申请页面
class MyApplyPage extends StatefulWidget {
  const MyApplyPage({super.key});

  @override
  State<MyApplyPage> createState() => _MyApplyPageState();
}

class _MyApplyPageState extends State<MyApplyPage> {
  String phone = "13675891821";

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      floatingActionButton: FloatingActionButton(
        shape: const CircleBorder(),
        backgroundColor: Colors.lightBlue,
        // elevation: 10,
        child: const Icon(Icons.phone),
        onPressed: () async{
          // showModalBottomSheet(
          //     context: context,
          //     backgroundColor: ConstConfig.transparentColor,
          //     shape: const RoundedRectangleBorder(
          //         borderRadius: BorderRadius.only(
          //             topLeft: Radius.circular(0),
          //             topRight: Radius.circular(0))),
          //     // isScrollControlled: true,
          //     builder: (context) {
          //       return SizedBox(
          //         height: 500.h,
          //         child: Column(
          //           children: [
          //             GestureDetector(
          //               onTap: () async {
          //                 // Uri url = Uri.parse('tel:$phone');
          //                 Uri url = Uri(scheme: "tel", path: phone);
          //                 if (await canLaunchUrl(url)) {
          //                   await launchUrl(url);
          //                 } else {
          //                   throw 'Could not launch $url';
          //                 }
          //               },
          //               child: Container(
          //                 margin: const EdgeInsets.all(10),
          //                 decoration: BoxDecoration(
          //                   color: ConstConfig.phoneColor,
          //                   borderRadius: BorderRadius.circular(8),
          //                 ),
          //                 height: 150.h,
          //                 width: double.infinity,
          //                 child: Row(
          //                   mainAxisAlignment: MainAxisAlignment.start,
          //                   children: [
          //                     Container(
          //                       padding:
          //                           EdgeInsets.only(left: 60.w, right: 10.w),
          //                       child: const Icon(
          //                         Icons.phone,
          //                         color: ConstConfig.phoneIconColor,
          //                       ),
          //                     ),
          //                     Container(
          //                       padding:
          //                           EdgeInsets.only(left: 30.w, right: 10.w),
          //                       child: Text(
          //                         "呼叫 $phone",
          //                         style: const TextStyle(
          //                             fontSize: 21,
          //                             color: ConstConfig.phoneTextColor),
          //                       ),
          //                     ),
          //                   ],
          //                 ),
          //               ),
          //             ),
          //             GestureDetector(
          //               onTap: () {
          //                 Navigator.of(context).pop();
          //               },
          //               child: Container(
          //                 margin: const EdgeInsets.all(10),
          //                 decoration: BoxDecoration(
          //                   color: ConstConfig.cancelPhoneColor,
          //                   borderRadius: BorderRadius.circular(8),
          //                 ),
          //                 height: 150.h,
          //                 width: double.infinity,
          //                 alignment: const Alignment(0, 0),
          //                 // color: Colors.black12,
          //                 child: const Text(
          //                   "取消",
          //                   style: TextStyle(
          //                       fontSize: 21,
          //                       color: ConstConfig.phoneTextColor),
          //                 ),
          //               ),
          //             )
          //           ],
          //         ),
          //       );
          //     });
          // Uri url = Uri.parse('tel:$phone');
          Uri url = Uri(scheme: "tel", path: phone);
          if (await canLaunchUrl(url)) {
            await launchUrl(url);
          } else {
            throw 'Could not launch $url';
          }
        },
      ),
      appBar: AppBar(
        title: const Text(""),
        backgroundColor: Colors.white,
      ),
      body: ListView(
        children: [
          Container(
            height: 700.h,
            decoration: const BoxDecoration(
              gradient: LinearGradient(
                begin: Alignment.topCenter,
                end: Alignment.bottomCenter,
                colors: [
                  Color.fromRGBO(158, 191, 254, 1),
                  Color.fromRGBO(158, 191, 254, 1),
                  Color.fromRGBO(158, 191, 254, 1),
                  Color.fromRGBO(158, 191, 254, 1),
                  Color.fromRGBO(158, 191, 254, 1),
                  Colors.white,
                ],
              ),
            ),
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                const Text(
                  "申请进度",
                  style: TextStyle(
                      color: Colors.white,
                      fontSize: 20,
                      fontWeight: FontWeight.bold),
                ),
                SizedBox(
                  height: 100.h,
                ),
                const Row(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: [
                    Icon(Icons.edit_note),
                    Text(
                      "待提交",
                      style: TextStyle(
                          color: Colors.white,
                          fontSize: 18,
                          fontWeight: FontWeight.bold),
                    ),
                  ],
                ),
                SizedBox(
                  height: 20.h,
                ),
                const Row(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: [
                    Icon(Icons.edit_note),
                    Text(
                      "待提交",
                      style: TextStyle(
                          color: Colors.white,
                          fontSize: 18,
                          fontWeight: FontWeight.bold),
                    ),
                  ],
                )
              ],
            ),
          ),
          WaitSubmit(
            title: "首付",
          ),
          WaitReview(
            title: "首付： 100",
          )
        ],
      ),
    );
  }
}


// 我的申请页面
class MyStartApplyPage extends StatefulWidget {
  const MyStartApplyPage({super.key});

  @override
  State<MyStartApplyPage> createState() => _MyStartApplyPageState();
}

class _MyStartApplyPageState extends State<MyStartApplyPage> {
  String phone = "13675891821";

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text(""),
        backgroundColor: Colors.white,
      ),
      body: ListView(
        children: const [
          WaitSubmit(
            title: "首付",
          ),
        ],
      ),
    );
  }
}
